import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    token: uni.getStorageSync('token') || '',
    hasLogin: false,
  },
  mutations: {
    updateToken (token, payload) {
      state.token = payload;
      uni.setStorageSync('token', payload);
      console.log("token 已经修改");
    },
    logout (state) {
      state.hasLogin = false;
      state.userInfo = {};
      uni.removeStorage({
        key: 'userInfo'
      })
    },
  },
  actions: {

  }
})

export default store